package org.example.myframework.frame.demo.factory;

public enum PayEnum {

    ALI_PAY(1, "支付宝"),
    WE_CHAT_PAY(2, "微信")
    ;

    private int code;
    private String desc;

    PayEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PayEnum getByCode(int code) {
        for (PayEnum payEnum : PayEnum.values()) {
            if (payEnum.code == code) {
                return payEnum;
            }
        }
        return null;
    }

}
